<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>视差滚动</title>
    <style>
      * {
        margin: 0;
        padding: 0;
      }
      .shell {
        height: 100vh;
        overflow-x: hidden;
        perspective: 3px;
      }
      .shell div {
        position: relative;
        display: flex;
        justify-content: center;
        align-items: center;
        font-style: 30px;
        letter-spacing: 2px;
      }
      .img {
        transform: translate(-1px) scale(1.6);
        background-size: cover;
        height: 100vh;
        z-index: -1;
      }
      .text {
        height: 50vh;
        background-color: #fff;
      }
      .text h1 {
        color: black;
      }
      .heading {
        z-index: -1;
        transform: translateY(-30vh) translateZ(1px);
        color: #fff;
        font-size: 30px;
      }
    </style>
  </head>
  <body>
    <div class="shell">
      <div class="img" style="background-image: url('./1.jpg')"></div>
      <div class="heading"><h1>When you are confused</h1></div>
      <div class="text"><h1>Set goals in your mind</h1></div>
      <div class="img" style="background-image: url('./2.jpg')"></div>
      <div class="heading"><h1>When you are down</h1></div>
      <div class="text"><h1>Try to wake up your beast in your head</h1></div>
      <div class="img" style="background-image: url('./1.jpg')"></div>
      <div class="heading"><h1>When people leave you</h1></div>
      <div class="text"><h1>It's time to start your season</h1></div>
      <div class="img" style="background-image: url('./2.jpg')"></div>
      <div class="heading"><h1>Come on,stranger.</h1></div>
    </div>
  </body>
</html>
